<?php

namespace app\api\controller\haibao;

use app\admin\model\HaibaojijinUser;
use app\api\controller\Base;
use think\Request;

/**
 * @author zero
 * @Time 2019/2/20
 *
 * Class HaibaoBase
 * @package app\api\controller\haibao
 *
 * 嗨爆集锦基类
 */
class HaibaoBase extends Base
{
    // openid
    public $openid;
    // 审核控制版本号
    public $control_version = '0.0.0';
    // 当前版本
    public $version;

    public $util;

    // 嗨爆集锦用户
    public $user = null;

    public function __construct(Request $request = null)
    {
        parent::__construct($request);
        $this->openid = $request->param('openid');
        $this->version = $request->param('version') ?: '1.0.0';
        if ($this->openid) {
            $this->user = HaibaojijinUser::get(['openid' => $this->openid]);
            if (!$this->user) {
                $this->error('no user');
            }
        }
    }

}
